package com.flute.haflute.jobbox.child;

import com.flute.haflute.jobbox.common.MapExecutor;
import com.flute.haflute.jobbox.communication.ChildCommunicationService;
import com.flute.haflute.jobbox.communication.messages.MapperReqMessage;
import com.flute.haflute.jobbox.communication.messages.MessageBase;

/**
 * MapReduce任务调度器
 */
public class MRTaskScheduler implements TaskScheduler {
	/** 通信平台的接口 */
	private ChildCommunicationService communicationService;

	public MRTaskScheduler(ChildCommunicationService service) {
		communicationService = service;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.flute.haflute.child.TaskScheduler#scheduleTask(com.flute.haflute.
	 * communication.messages.RequestMessage)
	 */
	@Override
	public void scheduleTask(MessageBase request) throws Exception {
		new Thread(new MapExecutor((MapperReqMessage) request,
				communicationService)).start();
	}

}
